package edu.unc.comp410.colemangeer.checkoutdemo;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

/**
 * 
 * @author ccoleman
 *
 * Product
 * ---The price of any product is >= $1.00 and <= $100,000.00
 */
public class ProductStub implements ISellable {

	private static Logger log = Logger.getLogger(ProductStub.class);

	private final Integer id;
	private final String name;
	private final Double price;

	public ProductStub(Integer id, String name, Double price) {

		// TODO: check these params too
		this.id = id;
		this.name = name;

		if (price < Double.valueOf(1) || price > Double.valueOf(100000)) {
			throw new IllegalArgumentException();
		} else {
			this.price = price;
		}

	}

	public Integer getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public double getPrice() {
		return price;
	}

	// returning List of products jsut like CatalogItem does
	// conforming to the ISellable interface

	public List<ProductStub> getAllProducts() {
		ArrayList<ProductStub> products = new ArrayList<ProductStub>();
		products.add(this);
		return products; // TODO: return innutable copy instead
	}

}
